<?php

namespace app\product\controller;
use app\common\controller\PCBase;
use app\common\controller\DBase;
use app\common\library\Upload;
use app\product\logic\ContractLogic;
use Throwable;
use  think\App;
class Contract extends PCBase
{


    /**
     * @desc   获取批次号列表
     * @author luckyXiong
     * @date   2024-10-28
     */
    public function index()
    {
        $params     = $this->request->post();
        return  (new ContractLogic())->getList($params);
    }

    /**
     * @desc   详情
     * @author zhangheng
     * @date   2024-10-28
     */
    public function info()
    {
        $params     = $this->request->post();
        return  (new ContractLogic())->info($params);
    }

    /**
     * @desc   获取批次号列表
     * @author luckyXiong
     * @date   2024-10-28
     */
    public function addContract()
    {
        $params     = $this->request->post();
        $admin_id   = $this->getAdminId();
        $params['admin_id'] = $admin_id;
        return  (new ContractLogic())->add_contract($params);
    }




    /**
     * @desc   编辑获取批次号列表
     * @author luckyXiong
     * @date   2024-10-28
     */
    public function editContract()
    {
        $params     = $this->request->post();
        $admin_id   = $this->getAdminId();
        $params['admin_id'] = $admin_id;
        return  (new ContractLogic())->edit_contract($params);
    }


    /**
     * @desc   编辑获取批次号列表
     * @author luckyXiong
     * @date   2024-10-28
     */
    public function deleteContract()
    {
        $params     = $this->request->post();
        return  (new ContractLogic())->delete_contract($params);
    }


    /**
     * @desc   import
     * @author zhagnheng
     * @date   2024-12-16
     */
    public function import(){
        $admin_id   = $this->getAdminId();

        $file       = $this->request->file('file');
        $res        = (new Upload($file))->upload(null, $this->getAdminId()); 
        return  (new ContractLogic())->import($res['url'],$admin_id);
    }


    /**
     * @desc   合同详情
     * @author zhangheng
     * @date   2025-06-18
     */
    public function contact_info()
    {
        $params     = $this->request->post();
        return  (new ContractLogic())->contact_info($params);
    }


    /**
     * @desc   确认下单操作
     * @author zhangheng
     * @date   2025-06-18
     */
    public function confirm_order()
    {
        $params     = $this->request->post();
        return  (new ContractLogic())->confirm_order($params);
    }

    /**
     * @desc   确认下单操作消费方法
     * @author zhangheng
     * @date   2025-06-18
     */
    public function confirm_order_consumer()
    {
        $params     = $this->request->post();
        (new ContractLogic())->confirm_order_consumer($params);
        return  $this->jsonMessage(200,true,'操作成功','');
    }


    /**
     * @desc   在途数据导出
     * @author zhangheng
     * @date   2025-06-18
     */
    public function export_onway_sku()
    {
        $params     = $this->request->post();
        return  (new ContractLogic())->expor_onway_sku($params);
    }




}